//
//  XOWMIDCartCell.m
//  XOWMSDK
//
//  Created by skyline on 2018/3/15.
//  Copyright © 2018年 skyline. All rights reserved.
//

#import "XOWMIDCartCell.h"
@interface XOWMIDCartCell()
@property (nonatomic, strong) XOWMLabel *titleLBL;
@property (nonatomic, strong) UIView *line;
@end
@implementation XOWMIDCartCell
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
        self.line.hidden = NO;
        self.IMG.hidden = NO;
    }
    return self;
}
- (XOWMLabel *)titleLBL
{
    if (!_titleLBL)
    {
        _titleLBL = [[XOWMLabel alloc] init];
        _titleLBL.textColor = TEXT_BLACK_COLOR;
        _titleLBL.font = [UIFont systemFontOfSize:15];
        [self addSubview:_titleLBL];
        _titleLBL.c_centerY.equal(self);
        _titleLBL.c_left.equal(self).with.coffset(GAP / 2);
    }
    return _titleLBL;
}

- (XOWMImageView *)IMG
{
    if (!_IMG)
    {
        _IMG = [[XOWMImageView alloc] initWithImageName:@"unselect"];
        _IMG.bounds = CGRectMake(0, 0, 15, 15);
        _IMG.layer.cornerRadius = _IMG.bounds.size.width / 2.0;
        _IMG.layer.masksToBounds = YES;
        [self addSubview:_IMG];
        _IMG.c_centerY.equal(self);
        _IMG.c_right.equal(self).with.coffset( -GAP  /2);
        _IMG.c_size.equal(self.IMG.bounds.size);
    }
    return _IMG;
}

- (UIView *)line
{
    if (!_line)
    {
        _line = [[UIView alloc] init];
        _line.backgroundColor = CELL_LINE_COLOR;
        [self addSubview:_line];
        _line.c_left.equal(self);
        _line.c_right.equal(self);
        _line.c_bottom.equal(self);
        _line.c_height.equal(1.0);

    }
    return _line;
}
- (void)setTitle:(NSString *)title
{
    if (_title != title)
    {
        _title = title;
        self.titleLBL.text = title;
    }
}

- (void)setSelect:(BOOL)select
{
    if (_select != select)
    {
        _select = select;
        if (_select)
        {
            _IMG.imageName = @"selected";
            _IMG.backgroundColor = [XOWMHelper shareHelp].color;
        }
        else
        {_IMG.imageName = @"unselect";
            _IMG.backgroundColor = [UIColor clearColor];
        }
    }
}

- (void)setSelected:(BOOL)selected
{
    [super setSelected:selected];
}

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

//这里设置bgView或者contentview的颜色，等于cell高亮状态的颜色
- (void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated
{
    [super setHighlighted:highlighted animated:animated];
    UIView *view = [[UIView alloc] init];
    view.backgroundColor = RGBA(95, 158, 211, 0.3);
    self.selectedBackgroundView = view;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}


- (void)sp_getUsersMostLiked {
    NSLog(@"Check your Network");
}
@end
